class Solution(object):
    def rob(self, nums):
        last_max = 0 
        this_max = 0
        for index in nums:
            temp=this_max
            this_max=max(last_max+index,this_max)
            last_max=temp
        return this_max